{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#   [Py4Hw Tutorial](../Tutorial.ipynb)> 0.1 Installing\n",
    "###  [Next: 0.2 Cloning the development repository](cloning.ipynb)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Py4HW is available from the pypi repository, so you can just install by running \n",
    "\n",
    "`pip install py4hw`\n",
    "\n",
    "in your python console. In jupyter notebooks just run the following cell:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting py4hw\n",
      "  Using cached py4hw-0.0.5-py3-none-any.whl (35 kB)\n",
      "Requirement already satisfied: ipywidgets in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from py4hw) (7.6.3)\n",
      "Requirement already satisfied: matplotlib in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from py4hw) (3.4.2)\n",
      "Requirement already satisfied: nbwavedrom in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from py4hw) (0.2.0)\n",
      "Requirement already satisfied: ipykernel>=4.5.1 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipywidgets->py4hw) (5.3.4)\n",
      "Requirement already satisfied: nbformat>=4.2.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipywidgets->py4hw) (5.0.8)\n",
      "Requirement already satisfied: widgetsnbextension~=3.5.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipywidgets->py4hw) (3.5.1)\n",
      "Requirement already satisfied: ipython>=4.0.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipywidgets->py4hw) (7.24.1)\n",
      "Requirement already satisfied: traitlets>=4.3.1 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipywidgets->py4hw) (5.0.5)\n",
      "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipywidgets->py4hw) (1.0.0)\n",
      "Requirement already satisfied: jupyter-client in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipykernel>=4.5.1->ipywidgets->py4hw) (6.1.7)\n",
      "Requirement already satisfied: tornado>=4.2 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipykernel>=4.5.1->ipywidgets->py4hw) (6.0.4)\n",
      "Requirement already satisfied: setuptools>=18.5 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipython>=4.0.0->ipywidgets->py4hw) (49.6.0.post20201009)\n",
      "Requirement already satisfied: decorator in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipython>=4.0.0->ipywidgets->py4hw) (4.4.2)\n",
      "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipython>=4.0.0->ipywidgets->py4hw) (3.0.18)\n",
      "Requirement already satisfied: jedi>=0.16 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipython>=4.0.0->ipywidgets->py4hw) (0.17.1)\n",
      "Requirement already satisfied: pickleshare in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipython>=4.0.0->ipywidgets->py4hw) (0.7.5)\n",
      "Requirement already satisfied: backcall in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipython>=4.0.0->ipywidgets->py4hw) (0.2.0)\n",
      "Requirement already satisfied: colorama in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipython>=4.0.0->ipywidgets->py4hw) (0.4.4)\n",
      "Requirement already satisfied: matplotlib-inline in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipython>=4.0.0->ipywidgets->py4hw) (0.1.2)\n",
      "Requirement already satisfied: pygments in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from ipython>=4.0.0->ipywidgets->py4hw) (2.7.2)\n",
      "Requirement already satisfied: parso<0.8.0,>=0.7.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets->py4hw) (0.7.0)\n",
      "Requirement already satisfied: jupyter-core in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbformat>=4.2.0->ipywidgets->py4hw) (4.6.3)\n",
      "Requirement already satisfied: ipython-genutils in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbformat>=4.2.0->ipywidgets->py4hw) (0.2.0)\n",
      "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbformat>=4.2.0->ipywidgets->py4hw) (3.2.0)\n",
      "Requirement already satisfied: attrs>=17.4.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->py4hw) (20.2.0)\n",
      "Requirement already satisfied: pyrsistent>=0.14.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->py4hw) (0.17.3)\n",
      "Requirement already satisfied: six>=1.11.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->py4hw) (1.15.0)\n",
      "Requirement already satisfied: importlib-metadata in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->py4hw) (4.5.0)\n",
      "Requirement already satisfied: wcwidth in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets->py4hw) (0.2.5)\n",
      "Requirement already satisfied: notebook>=4.4.1 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from widgetsnbextension~=3.5.0->ipywidgets->py4hw) (6.1.4)\n",
      "Requirement already satisfied: Send2Trash in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (1.5.0)\n",
      "Requirement already satisfied: prometheus-client in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.8.0)\n",
      "Requirement already satisfied: terminado>=0.8.3 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.9.1)\n",
      "Requirement already satisfied: argon2-cffi in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (20.1.0)\n",
      "Requirement already satisfied: pyzmq>=17 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (19.0.2)\n",
      "Requirement already satisfied: nbconvert in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (6.0.7)\n",
      "Requirement already satisfied: jinja2 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (2.11.2)\n",
      "Requirement already satisfied: python-dateutil>=2.1 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from jupyter-client->ipykernel>=4.5.1->ipywidgets->py4hw) (2.8.1)\n",
      "Requirement already satisfied: pywin32>=1.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from jupyter-core->nbformat>=4.2.0->ipywidgets->py4hw) (228)\n",
      "Requirement already satisfied: pywinpty>=0.5 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from terminado>=0.8.3->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.5.7)\n",
      "Requirement already satisfied: cffi>=1.0.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (1.14.3)\n",
      "Requirement already satisfied: pycparser in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (2.20)\n",
      "Requirement already satisfied: zipp>=0.5 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from importlib-metadata->jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->py4hw) (3.4.0)\n",
      "Requirement already satisfied: typing-extensions>=3.6.4 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from importlib-metadata->jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->py4hw) (3.7.4.3)\n",
      "Requirement already satisfied: MarkupSafe>=0.23 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (1.1.1)\n",
      "Requirement already satisfied: pillow>=6.2.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from matplotlib->py4hw) (8.0.1)\n",
      "Requirement already satisfied: numpy>=1.16 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from matplotlib->py4hw) (1.20.3)\n",
      "Requirement already satisfied: kiwisolver>=1.0.1 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from matplotlib->py4hw) (1.3.0)\n",
      "Requirement already satisfied: pyparsing>=2.2.1 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from matplotlib->py4hw) (2.4.7)\n",
      "Requirement already satisfied: cycler>=0.10 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from matplotlib->py4hw) (0.10.0)\n",
      "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.5.1)\n",
      "Requirement already satisfied: mistune<2,>=0.8.1 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.8.4)\n",
      "Requirement already satisfied: testpath in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.4.4)\n",
      "Requirement already satisfied: defusedxml in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.6.0)\n",
      "Requirement already satisfied: jupyterlab-pygments in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.1.2)\n",
      "Requirement already satisfied: entrypoints>=0.2.2 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.3)\n",
      "Requirement already satisfied: pandocfilters>=1.4.1 in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (1.4.2)\n",
      "Requirement already satisfied: bleach in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (3.2.1)\n",
      "Requirement already satisfied: async-generator in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (1.10)\n",
      "Requirement already satisfied: nest-asyncio in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (1.4.1)\n",
      "Requirement already satisfied: packaging in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (20.4)\n",
      "Requirement already satisfied: webencodings in c:\\users\\dcr\\anaconda3\\lib\\site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->py4hw) (0.5.1)\n",
      "Installing collected packages: py4hw\n",
      "Successfully installed py4hw-0.0.5\n"
     ]
    }
   ],
   "source": [
    "!pip install py4hw"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "After installing you will need to import the library, with a regular import"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "In C:\\Users\\dcr\\anaconda3\\lib\\site-packages\\matplotlib\\mpl-data\\stylelib\\_classic_test.mplstyle: \n",
      "The text.latex.preview rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
      "In C:\\Users\\dcr\\anaconda3\\lib\\site-packages\\matplotlib\\mpl-data\\stylelib\\_classic_test.mplstyle: \n",
      "The mathtext.fallback_to_cm rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
      "In C:\\Users\\dcr\\anaconda3\\lib\\site-packages\\matplotlib\\mpl-data\\stylelib\\_classic_test.mplstyle: Support for setting the 'mathtext.fallback_to_cm' rcParam is deprecated since 3.3 and will be removed two minor releases later; use 'mathtext.fallback : 'cm' instead.\n",
      "In C:\\Users\\dcr\\anaconda3\\lib\\site-packages\\matplotlib\\mpl-data\\stylelib\\_classic_test.mplstyle: \n",
      "The validate_bool_maybe_none function was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
      "In C:\\Users\\dcr\\anaconda3\\lib\\site-packages\\matplotlib\\mpl-data\\stylelib\\_classic_test.mplstyle: \n",
      "The savefig.jpeg_quality rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
      "In C:\\Users\\dcr\\anaconda3\\lib\\site-packages\\matplotlib\\mpl-data\\stylelib\\_classic_test.mplstyle: \n",
      "The keymap.all_axes rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
      "In C:\\Users\\dcr\\anaconda3\\lib\\site-packages\\matplotlib\\mpl-data\\stylelib\\_classic_test.mplstyle: \n",
      "The animation.avconv_path rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
      "In C:\\Users\\dcr\\anaconda3\\lib\\site-packages\\matplotlib\\mpl-data\\stylelib\\_classic_test.mplstyle: \n",
      "The animation.avconv_args rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n"
     ]
    }
   ],
   "source": [
    "import py4hw"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can check the version of the library by running..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Installed py4hw version = 0.0.5\n",
      "Latest version = 0.0.5\n",
      "\n"
     ]
    }
   ],
   "source": [
    "import pkg_resources\n",
    "\n",
    "current = pkg_resources.get_distribution('py4hw').version\n",
    "latest = '0.0.5'\n",
    "print('Installed py4hw version =', current)\n",
    "print('Latest version =', latest)\n",
    "print()\n",
    "if (latest != current):\n",
    "    print('Check Pypi for an UPDATE!')\n",
    "    print('Run \"pip install py4hw\"')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
